<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page pageEncoding="utf-8" isELIgnored="false" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>校园超市管理系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/jsp/css/public.css"/>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/jsp/css/style.css"/>
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/js/easyui/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/js/easyui/themes/icon.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/jsp/js/bootstrap/css/bootstrap.min.css"/>
    <script type="text/javascript" src="${pageContext.request.contextPath}/jsp/js/jQuery1.11.1.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui/jquery.easyui.min.js"></script>
    <%--  <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.pagination.js"></script>--%>
    <script type="text/javascript"
            src="${pageContext.request.contextPath}/js/easyui/locale/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript">
        var  loginOut;
        var xiugai;
        $(function () {
            xiugai = function myxiugai() {
                $.ajax({
                    url: "${pageContext.request.contextPath}/provider/updateProvider",
                    type: "post",
                    data: $("#form1").serialize(),
                    statusCode: {
                        403: function() {
                            $.messager.alert("温馨提示","无权访问","error");
                        }
                    },
                    success: function (data) {
                        if (data.data == 1) {
                            $.messager.alert("温馨提示", "修改成功", "info");
                            setTimeout(function(){
                                location.href="${pageContext.request.contextPath}/jsp/providerList.jsp";
                            },2000);
                        } else {
                            $.messager.alert("温馨提示", "修改失败", "error");
                        }
                    }
                });
            }

            var id = $("#proid").val();
            $.ajax({
                url: "${pageContext.request.contextPath}/proList",
                type: "post",
                datatype: "json",
                success: function (data) {
                    $.each(data.data, function (i, dom) {
                        $("#supplier").append("<option value=" + dom.id + ">" + dom.proName + "</option>");
                    });
                    for (var i = 0; i < data.length; i++) {
                        if (i == id) {
                            $("#supplier").get(0).selectedIndex = i;
                        }
                    }

                }
            });
            $("#phone").blur(function () {
                var com = $("#productUnit").val();
                if (com == '') {
                    $.messager.alert("温馨提示", "单位不能为空", "error");
                } else {
                    var num = $("#phone").val();
                    var money = com * num;
                    $("#address").val(money);
                }
            });

            loginOut=function userLoginOut() {
                $.messager.confirm("温馨提示", "确定要退出吗？", function (r) {
                    if (r) {
                        location.href="${pageContext.request.contextPath}/loginout";
                    } else {
                        return false;
                    }

                });
            }
        });
    </script>
</head>
<body>
<!--头部-->
<header class="publicHeader">
    <h1>校园超市管理系统</h1>

    <div class="publicHeaderR">
        <p><span>下午好！</span><span style="color: #fff21b">${keyword} ${login}</span> , 欢迎你！</p>
        <!--<a href="login.html">退出</a>-->
    </div>
</header>
<!--时间-->
<section class="publicTime">
    <span id="time">2015年1月1日 11:11  星期一</span>
    <a href="#">温馨提示：为了能正常浏览，请使用高版本浏览器！（IE10+）</a>
</section>
<!--主体内容-->
<section class="publicMian ">
    <div class="left">
        <h2 class="leftH2">
            <span class="span_gn">功能列表</span>
        </h2>
        <nav>
            <ul class="list">
                <li><a href="${pageContext.request.contextPath}/jsp/productList.jsp">商品管理</a></li>
                <li><a href="${pageContext.request.contextPath}/jsp/billList.jsp">订单管理</a></li>
                <li id="active"><a href="${pageContext.request.contextPath}/jsp/providerList.jsp">供应商管理</a></li>
                <li ><a href="${pageContext.request.contextPath}/jsp/userList.jsp">用户管理</a></li>
                <li ><a href="${pageContext.request.contextPath}/jsp/password.jsp">密码修改</a></li>
                <li><a onclick="loginOut()">退出系统</a></li>
            </ul>
        </nav>
    </div>
    <div class="right">
        <div class="location">
            <strong>你现在所在的位置是:</strong>
            <span>供应商管理页面 >> 供应商修改页</span>
        </div>
        <div class="providerAdd">
            <form  id="form1">
                <!--div的class 为error是验证错误，ok是验证成功-->
                <%--<c:forEach items="${provider}" var="item">--%>
                    <input name="id" type="hidden" value="${provider.id}"/>
                    <div class="">
                        <label for="providerId">供应商编码：</label>
                        <input type="text" value="${provider.proCode}" name="proCode" id="providerId" placeholder="PRO-CODE—001"/>
                        <span>*</span>
                    </div>
                    <div>
                        <label for="providerName">供应商名称：</label>
                        <input type="text" value="${provider.proName}" name="proName" id="providerName" placeholder="测试供应商001"/>
                        <span >*</span>
                    </div>
                    <div>
                        <label for="people">联系人：</label>
                        <input type="text" value="${provider.proContact}" name="proContact" id="people" placeholder="韩露"/>
                        <span>*</span>

                    </div>
                    <div>
                        <label for="phone">联系电话：</label>
                        <input type="text" value="${provider.proPhone}" name="proPhone" id="phone" placeholder="15918230478"/>
                        <span></span>
                    </div>
                    <div>
                        <label for="address">联系地址：</label>
                        <input type="text"  value="${provider.proAddress}" name="proAddress" id="address" placeholder="北京"/>
                        <span></span>

                    </div>
                    <div>
                        <label for="fax">传真：</label>
                        <input type="text" value="${provider.proFax}" name="proFax" id="fax" placeholder="15918230478"/>
                        <span></span>

                    </div>
                    <div>
                        <label for="describe">描述：</label>
                        <input type="text" value="${provider.proDesc}" name="proDesc" id="describe" placeholder="描述"/>
                        <span></span>

                    </div>
                    <div class="providerAddBtn">
                        <!--<a href="#">保存</a>-->
                        <!--<a href="providerList.jsp">返回</a>-->
                        <input type="button" value="保存" onclick="xiugai()"/>
                        <input type="button" value="返回" onclick="history.back(-1)"/>
                    </div>
                <%--</c:forEach>--%>
            </form>
        </div>

    </div>
</section>
<footer class="footer">
    版权归本超市所有
</footer>
<script src="js/time.js"></script>

</body>
</html>